Ext.define('App.project.model.ProjectViewModel', {
    extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.ProjectViewModel',
    requires: ['App.project.model.ProjectModel'],
    data: {
        columns: [{
            header: 'ID',
            dataIndex: 'id',
            hidden: true
        }, {
            header: '内部Po号',
            dataIndex: 'innerPoNumber',
            width: 160,height:35
        }, {
            header: '项目名称',
            dataIndex: 'name',
            width: 300
        }, {
            header: '项目编号',
            dataIndex: 'projectCode',
            width: 160
        }, {
            header: '项目类型',
            dataIndex: 'projectType'
        }, {
            header: '是否为上网项目',
            dataIndex: 'business'
        }, {
            header: '计费类型',
            dataIndex: 'billingType'
        }, {
            xtype: 'ymdcolumn',
            header: '开始时间',
            dataIndex: 'startDate'
        }, {
            xtype: 'ymdcolumn',
            header: '计划结项时间',
            dataIndex: 'plannedEndDate'
        }, {
            header: '项目经理工号',
            dataIndex: 'pmNo'
        }, {
            header: '项目经理',
            dataIndex: 'projectManager'
        }, {
            header: '所在DU',
            dataIndex: 'du'
        }, {
            header: '所在交付部',
            dataIndex: 'dd',
            width: 130
        }, {
            header: '所在地域',
            dataIndex: 'area'
        }, {
            header: '预计工作量(人天)',
            dataIndex: 'projectWorkload'
        }, {
            header: '需求总人数',
            dataIndex: 'itemPlanMember'
        }, {
            xtype: 'numbercolumn',
            formatter: 'percent("###.##")',
            header: 'PO占比',
            dataIndex: 'poProportion'
        }, {
            header: '中软QA',
            dataIndex: 'chinasoftQa'
        }, {
            header: '华为QA',
            dataIndex: 'huaweiQa'
        }, {
            header: '华为项目经理',
            dataIndex: 'huaweiProjectManager'
        }, {
            header: '描述',
            dataIndex: 'description'
        }, {
            header: '创建人',
            dataIndex: 'creator',
            hidden: true
        }, {
            xtype: 'cdtcolumn',
            header: '创建时间',
            dataIndex: 'cdt',
            hidden: true
        }],
        search: {
            simpleSearch: true,
            advancedSearch: true,
            fields: [{
                name: "内部Po号",
                field: "innerPoNumber",
                vtype: 's',
                opt: 'like'
            }, {
                name: "项目名称",
                field: "name",
                vtype: 's',
                opt: 'like'
            }, {
                name: "项目经理",
                field: "projectManager",
                vtype: 's',
                opt: 'like'
            }, {
                name: "项目编号",
                field: "projectCode",
                vtype: 's',
                opt: 'like'
            }, {
                name: "项目类型",
                field: "projectType",
                vtype: 's',
                opt: 'like'
            }]
        }
    },
    stores: {
        Query: {
            autoLoad: false,
            model: 'App.project.model.ProjectModel',
            pageSize: 25,
            remoteSort: true,
            sorters: [{
                property: 'cdt',
                direction: 'desc'
            }],
            proxy: {
                type: 'majax',
                url: 'project/query_simple',
                reader: {
                    type: 'json',
                    rootProperty: 'data',
                    totalProperty: 'total'
                }
            }
        }
    }
});